<%@page import="java.util.*"%>
<%@page import="com.agou.core.util.*"%>
<%@page import="com.agou.core.enums.*"%>
<%@page import="com.agou.ssh.core.base.*"%>
<%@page import="com.agou.app.AppContext"%>
<%@page import="com.agou.ssh.web.*"%>
<%@page import="com.agou.app.admin.enums.*"%>
<%@page import="com.agou.app.admin.dbconfig.bean.*"%>
<%!
public String getWebRoot(HttpServletRequest request){
	String strWebRoot = "";
  	strWebRoot = request.getScheme();
	strWebRoot += "://";
	strWebRoot += request.getServerName();
	int port = request.getServerPort();
	if (port != 80) {
		strWebRoot += ":" + port;
	}
	strWebRoot += request.getContextPath() + "/";
  	return strWebRoot;
}
%>
<%
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setHeader("Expires","0");

String servletPath = request.getServletPath();
String WebRoot = getWebRoot(request);
AppContext acx = WebUtil.getAppContext(request);
ActionResultSet dataSet = (ActionResultSet)request.getAttribute("actionResultSet");
%>
<link rel="stylesheet" type="text/css" href="<%=WebRoot%>res/jquery/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="<%=WebRoot%>res/jquery/themes/icon.css"/>
<link rel="stylesheet" type="text/css" href="<%=WebRoot%>res/agou.css"/>
<script type="text/javascript" src="<%=WebRoot%>res/jquery/jquery.js"></script>
<script type="text/javascript" src="<%=WebRoot%>res/jquery/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=WebRoot%>res/agou.js"></script>
<%
//添加业务使用
System.out.println("servletPath = " + servletPath);
	int lastIndex = servletPath.lastIndexOf("/") +1 ;
	String resPath = servletPath.substring(1 , lastIndex);
	String jspFile = servletPath.substring(lastIndex);
	int  fileNameIndex = jspFile.lastIndexOf(".");
	String resName = jspFile.substring(0 , fileNameIndex);
	String cssPath = WebRoot + resPath + "res/" + resName + ".css";
	String jsPath = WebRoot + resPath + "res/" + resName + ".js";
%>
<link rel="stylesheet" type="text/css" href="<%=cssPath%>"/>
<script type="text/javascript" src="<%=jsPath%>"></script>

<script type="text/javascript">
	var g_appcontext = new Object();
	g_appcontext.WebRoot = "<%=WebRoot%>";
	//g_appcontext.screeWidth = window.screen.width;
	//g_appcontext.screeHeight = window.screen.height;
	<%if(acx != null){%>
		g_appcontext.isLogin = "<%=acx.isLogin %>";
		g_appcontext.projectName = "<%=acx.projectName %>";
		g_appcontext.createDate = "<%=acx.createDate.formatDate() %>";
		g_appcontext.userLoginId = "<%=acx.userLoginId %>";
		g_appcontext.userName = "<%=acx.userName %>";
		g_appcontext.updateDate = "<%=acx.updateDate.formatDate() %>";
		g_appcontext.sysTimestamp = "<%=acx.sysTimestamp %>";
		g_appcontext.remoteHost = "<%=acx.remoteHost %>";
		g_appcontext.remotePort = "<%=acx.remotePort %>";
		g_appcontext.serverHost = "<%=acx.serverHost %>";
		g_appcontext.serverPort = "<%=acx.serverPort %>";
		g_appcontext.servletPath = "<%=acx.servletPath %>";
		g_appcontext.sessionId = "<%=acx.sessionId %>";
	<%}else{%>
		g_appcontext.isLogin = "false";
		g_appcontext.projectName = "";
		g_appcontext.createDate = "";
		g_appcontext.userLoginId = "";
		g_appcontext.userName = "";
		g_appcontext.updateDate = "";
		g_appcontext.sysTimestamp = "";
		g_appcontext.remoteHost = "";
		g_appcontext.remoteIp = "";
		g_appcontext.remotePort = "";
		g_appcontext.remoteUser = "";
		g_appcontext.serverName = "";
		g_appcontext.serverPort = "";
		g_appcontext.requestURI = "";
		g_appcontext.servletPath = "";
		g_appcontext.sessionId = "";
	<%}%>
	
	/**
	* fan ye page
	*/
function pagerFilter(data){
	if (typeof data.length == 'number' && typeof data.splice == 'function'){	// is array
		data = {
			total: data.length,
			rows: data
		};
	}
	var dg = $(this);
	var opts = dg.datagrid('options');
	var pager = dg.datagrid('getPager');
	pager.pagination({
		onSelectPage:function(pageNum, pageSize){
			opts.pageNumber = pageNum;
			opts.pageSize = pageSize;
			pager.pagination('refresh',{
				pageNumber:pageNum,
				pageSize:pageSize
			});
			dg.datagrid('loadData',data);
		}
	});
	if (!data.originalRows){
		data.originalRows = (data.rows);
	}
	var start = (opts.pageNumber-1)*parseInt(opts.pageSize);
	var end = start + parseInt(opts.pageSize);
	data.rows = (data.originalRows.slice(start, end));
	return data;
}//end function  pagerFilter
</script>
<base href="<%=WebRoot%>">